home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 376-400 / disk_376 / aztecarp / sources.lzh / wbparse.c < prev   
C/C++ Source or Header  |  1990-08-01  |  1KB  |  58 lines

  1. /* Copyright (C) 1986,1987 by Manx Software Systems, Inc. */
  2.  
  3. /*
  4.  *    This routine is called from the _main() routine and is used to
  5.  *    open a window for standard I/O to use. The window is actually
  6.  *    defined by setting the ToolType, "WINDOW", to the desired window
  7.  *    specification. If this is not required, this routine may be
  8.  *    replaced by a stub in the users main program. Note that even if
  9.  *    this code is called by _main(), if the WINDOW tool type is not
  10.  *    defined, there will be no window.
  11.  *
  12.  *    EXAMPLE:    WINDOW=CON:0/0/640/200/Test Window
  13.  */
  14.  
  15. /* tweeked to handle v1.4 wbench startup */
  16.  
  17. void *IconBase;
  18.  
  19. _wb_parse(struct Process *pp,struct WBStartup *wbm)
  20. {
  21.     if(IconBase = OpenLibrary("icon.library",0))
  22.     {
  23.         struct DiskObject *dop;
  24.  
  25.         if(dop = GetDiskObject(wbm -> sm_ArgList -> wa_Name))
  26.         {
  27.             char *cp;
  28.  
  29.             if(cp = FindToolType(dop -> do_ToolTypes,"WINDOW"))
  30.             {
  31.                 BPTR wind;
  32.  
  33.                 if(wind = Open(cp, MODE_OLDFILE))
  34.                 {
  35.                     struct FileHandle *fhp;
  36.  
  37.                     fhp = (struct FileHandle *)BADDR(wind);
  38.  
  39.                     pp -> pr_ConsoleTask    = (APTR)fhp -> fh_Type;
  40.                     pp -> pr_CIS        = (BPTR)wind;
  41.                     pp -> pr_COS        = (BPTR)Open("*", MODE_OLDFILE);
  42.  
  43.                     /* !!! 1.4 tweek */
  44.  
  45.                     _devtab[0] . mode &= ~O_STDIO;    /* setup for exit to close these if we succeeded */
  46.                     _devtab[1] . mode &= ~O_STDIO;
  47.                 }
  48.             }
  49.  
  50.             FreeDiskObject(dop);
  51.         }
  52.  
  53.         CloseLibrary(IconBase);
  54.  
  55.         IconBase = NULL;
  56.     }
  57. }
  58.